/*
 * @Author: David Ma
 * @FilePath: \huaxia-real-estate-web\src\api\staff.ts
 * @LastEditors: David Ma
 * @Description: 该文件用于...
 * @Date: 2024-01-01 17:59:28
 */
import instance from "@/utils/request";
/**
 * 员工表
 *
 * Staff
 */
export interface Staff {
    stfNo?: string;
    dpNo?: string;
    stfName?: string;
    stfSex?: string;
    stfIdno?: string;
    stfQq?: string;
    stfEmail?: string;
    stfLocation?: string;
    stfLevel?: string;
    stfCardno?: string;
    stfStatus?: string;
}
export interface Task {
    stfNo?: string;
    pjtNo?: string;
    pcsNo?: string;
}
export interface Department {
    dpNo?: string;
    dpName?: string;
    dpTel?: string;
    dpCaptain?: string;
}
// 查询所有Staff
export function getAllStaff() {
    return instance.get('/staff');
}
// 查询所有部门
export function getAllDepartment() {
    return instance.get('/staff');
}
//模糊查询对应条件的Staff
export function getStaffsByCondition(condition: Staff) {
    return instance.post('/staff/queryByCondition' , condition);
}
// 根据Staffid查Staff信息
export function getStaffByCltNo(cno: string) {
    return instance.get('/staff/' + cno);
}
// 修改staff
export function modifyStaffInfo(staff: Staff) {
    return instance.put('/staff', staff);
}
// 添加staff
export function addStaff(staff: Staff) {
    return instance.post('/staff', staff);
}
// 删除staff
export function deleteStaffInfo(id: String) {
    return instance.delete('/staff?id=' + id);
}
// 主管分配任务给员工
export function assignTask(task) {
    return instance.post('/staff/allocateTask', null, {
        params: {
            pjtNo: task.pjtNo,
            pcsNo: task.pcsNo,
            stfNo: task.stfNo
        }
    });
}

// 查询当前主管身份下所在部门的所有员工
export function getStaffsByDpNo(dpNo: string) {
    return instance.get('/staff/queryStaffByUserId/' + dpNo);
}
